﻿/*
____
 L|ypps Web controls for ASP.NET

Copyright (c) 2009 Alessandro Zifiglio, http://www.Typps.com
EMail: alessandro@Typps.com

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
namespace Typps.Tests
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using Typps;

    [TestClass]
    public class UnitTestTreeView
    {
        #region Methods

        [TestMethod]
        public void Render_MultiLevelSingleNode_MarkupListItem()
        {
            string clientID = "Editor1";
            string cssSelectorClass = "treeview";
            HTreeView tv = new HTreeView(clientID, cssSelectorClass);
            HTreeNode rootNode = new HTreeNode("A", "aNode");
                rootNode.ChildNodes.Add(
                        new HTreeNode("B", "bNode"));
            tv.Nodes.Add(rootNode);
            string html = tv.Render();
            string output = "<div class=\"treeview\"><ul id=\"Editor1\"><li class=\"rootnode\"><b class=\"nodeexpand\">&nbsp;</b><span class=\"clickablenonlink\"><span>A</span><b style=\"display:none\">aNode</b></span><ul class=\"nodehide\"><li class=\"leafnode\"><span class=\"nonlink\"><span>B</span><b style=\"display:none\">bNode</b></span></li></ul></li></ul></div>";
            Assert.AreEqual(html, output);
        }

        [TestMethod]
        public void Render_SingleLevelSingleNode_MarkupListItem()
        {
            string clientID = "Editor1";
            string cssSelectorClass = "treeview";
            HTreeView tv = new HTreeView(clientID, cssSelectorClass);
            tv.Nodes.Add(new HTreeNode("A", "aNode"));
            string html = tv.Render();
            string output = "<div class=\"treeview\"><ul id=\"Editor1\"><li class=\"rootnode leafnode\"><span class=\"nonlink\"><span>A</span><b style=\"display:none\">aNode</b></span></li></ul></div>";
            Assert.AreEqual(html, output);
        }

        #endregion Methods
    }
}